package adapter;

import java.util.ArrayList;

import com.qzhy.female.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import model.FocusInfo;
import utils.UILUtils;

public class FocusCircleAdapter extends BaseAdapter{

	private Context context;
	private ArrayList<FocusInfo> mFocunInfo;
	private ViewHold viewHold;

	public FocusCircleAdapter(Context context) {
		this.context = context;
		
	}
	public FocusCircleAdapter(Context context,ArrayList<FocusInfo> mFocunInfo) {
		this.context = context;
		this.mFocunInfo = mFocunInfo;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mFocunInfo.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView==null){
			convertView=View.inflate(context, R.layout.item_focus_circle, null);
			viewHold = new ViewHold();
			viewHold.ImgCircleIcon=(ImageView) convertView.findViewById(R.id.img_circle_icon);
			viewHold.TvCircleName=(TextView) convertView.findViewById(R.id.tv_circle_name);
			convertView.setTag(viewHold);
		}else {
			viewHold = (ViewHold) convertView.getTag();
		}	
		viewHold = (ViewHold) convertView.getTag();
		viewHold.TvCircleName.setText(mFocunInfo.get(position).getName());
		UILUtils.displayImageNoAnim(mFocunInfo.get(position).getThumbnail(), viewHold.ImgCircleIcon);
		return convertView;
	}
	
	class ViewHold{
		ImageView ImgCircleIcon;
		TextView TvCircleName;
	}

}
